﻿ 
/*
//get resolve texture a  colorbuffer
            GetInputFromFrameBuffer();
            colorBuffer = Input;
            
            
            ///////////////////////////////////////////////////////////////////////////
            //**DEPTHBUFFER
            //

           
            //2) set fog settings for depthmap specs       
                Engine.GraphicsDevice.RenderState.FogEnable = true;
                Engine.GraphicsDevice.RenderState.FogStart = dofStart;
                Engine.GraphicsDevice.RenderState.FogDensity = dofDensity;
                Engine.GraphicsDevice.RenderState.FogEnd = dofStart + dofLength;
                Engine.GraphicsDevice.RenderState.FogTableMode = FogMode.Linear;
                Engine.GraphicsDevice.RenderState.FogColor = Color.White;

            //3)create a depthmap by drawing all components needed into rendertarget1
                Engine.GraphicsDevice.SetRenderTarget(0, renderTarget1);            

             
               
                //draw all models from our list that stored all last drawn models
                    foreach (Drawable3dComponent comp in this.Parent.DrawableRenderList)
                    {

                        //draw the objects using the depthmap shader
                        comp.DrawDepthMap();

                    } 

            //4)reset the rendertarget for future rendering
                Engine.GraphicsDevice.SetRenderTarget(0, null);

            //5)store the print as our depthbuffer               
                depthBuffer = renderTarget1.GetTexture();




            //////////////////////////////////////////////////////////
                //**COLORBUFFER
                
                // store the input texture as our colorbuffer
                
                





            ///////////////////////////////////////////////////////////
                //BLOOM EXTRACT
                //blurred bloom extract from color buffer
                //set shader settings      
                bloomExtractEffect.Parameters["BloomThreshold"].SetValue(BloomThreshold);

                DrawImageToRenderTarget(colorBuffer, renderTarget5, 0, 0, bloomExtractEffect, "BloomExtract");

                bloomBuffer = renderTarget5.GetTexture();
               
                //blur bloom
                //6)set horizontal blur settings
                SetParameters(GaussianBlurDirection.Horizontal); // Set horizontal parameters

                //7)render the colorbuffer into rendertarget2 using the blur shader from the effect file
                DrawImageToRenderTarget(bloomBuffer, renderTarget2, 0, 0, blurEffect, "Blur");

                //8)store the texture as the new blurbuffer
                bloomBuffer = renderTarget2.GetTexture();

                //9)set vertical blur settings
                SetParameters(GaussianBlurDirection.Vertical); // Set horizontal parameters
                //10)render the horizontally blurred image into rendertarget3
                DrawImageToRenderTarget(bloomBuffer, renderTarget3, 0, 0, blurEffect, "Blur");

                //11)store the texture as the new blurbuffer
                bloomBuffer = renderTarget3.GetTexture();

            

            /////////////////////////////////////////////////////////
            //**BLURBUFFER HORIZONTAL
            ////blurred colorbuffer for depth of field
                
                  //6)set horizontal blur settings
                      SetParameters(GaussianBlurDirection.Horizontal); // Set horizontal parameters

                  //7)render the colorbuffer into rendertarget2 using the blur shader from the effect file
                      DrawImageToRenderTarget(colorBuffer, renderTarget2, 0, 0, blurEffect, "Blur");

                  //8)store the texture as the new blurbuffer
                      blurBuffer = renderTarget2.GetTexture();

                  //9)set vertical blur settings
                      SetParameters(GaussianBlurDirection.Vertical); // Set horizontal parameters
                  //10)render the horizontally blurred image into rendertarget3
                      DrawImageToRenderTarget(blurBuffer, renderTarget3, 0, 0, blurEffect, "Blur");

                  //11)store the texture as the new blurbuffer
                      blurBuffer = renderTarget3.GetTexture();
                

           
               
                  ////////////////////////////////////////////////////////////////////////
                  //DEPTH OF FIELD
         

                  ShaderEnabled = true;
                 
                  DofEffect.CurrentTechnique = DofEffect.Techniques["DepthOfField"];
                  this.Effect = DofEffect;
                  Effect.Parameters["xColorTexture"].SetValue(colorBuffer);
                  Effect.Parameters["xDepthTexture"].SetValue(depthBuffer);
                  Effect.Parameters["xBlurTexture"].SetValue(blurBuffer);
                
              //for direct output: render the depthmap into our Input texture and draw it through base class
              base.Draw();
         

            //////////////////////////////////////////////////////////////////////
            //LIGHT SCATTERING
           
            ShaderEnabled = true;
            GetInputFromFrameBuffer();
            
            //colorBuffer = Input;
            //scatter settings
            ScatterEffect.CurrentTechnique = ScatterEffect.Techniques["Scatter"];
            this.Effect = ScatterEffect;
            ScatterEffect.Parameters["frameTex"].SetValue(Input);
            ScatterEffect.Parameters["Exposition"].SetValue(this.Exposition);
            ScatterEffect.Parameters["View"].SetValue(camera.View); //(2000.0f, 2800.0f, 2000.0f)
            ScatterEffect.Parameters["WorldViewProjection"].SetValue(Matrix.CreateTranslation(camera.Position) * camera.View * camera.Projection);
            ScatterEffect.Parameters["LightPosition"].SetValue(new Vector3(2000.0f, 500.0f, 2000.0f));

            base.Draw();
           
         

            ShaderEnabled = true;
            //GetInputFromFrameBuffer();
            //colorBuffer = Input;
            //finally, blend the bloom buffer with our depth of field image            
            this.Effect = bloomCombineEffect;
            bloomCombineEffect.Parameters["BloomIntensity"].SetValue(BloomIntensity);
            bloomCombineEffect.Parameters["BaseIntensity"].SetValue(BaseIntensity);
            bloomCombineEffect.Parameters["BloomSaturation"].SetValue(BloomSaturation);
            bloomCombineEffect.Parameters["BaseSaturation"].SetValue(BaseSaturation);

            Engine.GraphicsDevice.Textures[1] = bloomBuffer;
            
            //Input = bloomBuffer;

            base.Draw();
           */